function out = decimate_sim(din, dec_factor, pixel_select)
%pixel_select - 0 : select first pixel in the window and drop the rest, 1 : select last pixel in the window and drop the rest

 level = pixel_select; % Currently decimate in hardware always selects pixel 0 and drops pixel 1 for decimate factor = 2
 
 [r c] = size(din);
 s = 1 + mod(level,2);
 out = din(s:dec_factor:r, s:dec_factor:c);